home *** CD-ROM | disk | FTP | other *** search
/ Programmer Plus 2007 / Programmer-Plus-2007.iso / Programming / XML Utilities / Professional Programmer XSL IDE / Xselerator25.msi / Data.Cab / F19626_LinksPush1.xsl < prev    next >
Encoding:
Extensible Markup Language  |  2001-10-04  |  2.1 KB  |  62 lines

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <!-- ===========================================================
  3.   Category:       HTML
  4.   Sub-category:   Hyperlinks
  5.   Author:         David Silverlight
  6.                   HeadGeek@xmlpitstop.com
  7.   Created:        2001-05-16
  8.   Description:-
  9.     This stylsheet demonstrates how to create hyperlinks from an
  10.     xml document.  Also note that we are using the "Push" method
  11.     to transform data from our xml document. The Push method is
  12.     an approach where templates are used extensively.  Using the
  13.     "Push" method, we are essentially defining templates for
  14.     each of our xml elements and "Pushing" our xml data towards
  15.     it.
  16. ================================================================ -->
  17. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  18.   <xsl:output method="html" />
  19.  
  20.   <xsl:template match="/">
  21.     <html>
  22.       <head>
  23.         <style type="text/css">
  24.         H1 {COLOR: red; FONT-FAMILY: Arial; FONT-SIZE: 14pt;}
  25.         H2 {COLOR: darkblue; FONT-FAMILY: Arial; FONT-SIZE: 12pt;}
  26.         .head {COLOR: darkblue; FONT-FAMILY: Arial; FONT-SIZE: 14pt;}
  27.         .subhead {COLOR: darkblue; FONT-FAMILY: Arial; FONT-SIZE: 12pt;}
  28.         .text {COLOR: black; FONT-FAMILY: Arial; FONT-SIZE: 12pt;}
  29.         TH {COLOR: white; FONT-FAMILY: Arial; background-color: darkblue;}
  30.         TD {COLOR: darkblue; FONT-FAMILY: Arial}
  31.         TR { background-color: beige; }
  32.         BODY { background-color: beige; }
  33.         </style>
  34.       </head>
  35.       <body>
  36.         <span class="subhead">Creating Hyperlinks from xml (Using the Push method)</span>
  37.         <br />
  38.         <br />
  39.         <xsl:value-of select="@url" />
  40.         <xsl:apply-templates />
  41.       </body>
  42.     </html>
  43.   </xsl:template>
  44.  
  45.   <xsl:template match="link">
  46.     <span class="text">
  47.       <b>Name:</b>
  48.       <xsl:value-of select="@name" />
  49.       <br />
  50.       <b>Description:</b>
  51.       <xsl:value-of select="@description" />
  52.       <br />
  53.       <b>URL:</b>
  54.       <a href="{@url}">
  55.         <xsl:value-of select="@url" />
  56.       </a>
  57.       <br />
  58.       <br />
  59.     </span>
  60.   </xsl:template>
  61. </xsl:stylesheet>
  62.